home *** CD-ROM | disk | FTP | other *** search
/ Tech Win 1995 November / CD [TECH_B].bin / tech_b / delphi / trial / disk4 / doc.pak / GRAPHICS.INT < prev    next >
Encoding:
Text File  |  1995-08-08  |  20.4 KB  |  550 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Delphi Visual Component Library                 }
  4. {                                                       }
  5. {       Copyright (c) 1995 Borland International        }
  6. {                                                       }
  7. {*******************************************************}
  8.  
  9. unit Graphics;
  10.  
  11. {$P+,S-,W-,R-}
  12. {$C PRELOAD}
  13.  
  14. interface
  15.  
  16. uses WinTypes, WinProcs, SysUtils, Classes;
  17.  
  18. { Graphics Objects }
  19.  
  20. type
  21.   TColor = -(COLOR_ENDCOLORS + 1)..$2FFFFFF;
  22.  
  23. const
  24.   clScrollBar = TColor(-COLOR_SCROLLBAR - 1);
  25.   clBackground = TColor(-COLOR_BACKGROUND - 1);
  26.   clActiveCaption = TColor(-COLOR_ACTIVECAPTION - 1);
  27.   clInactiveCaption = TColor(-COLOR_INACTIVECAPTION - 1);
  28.   clMenu = TColor(-COLOR_MENU - 1);
  29.   clWindow = TColor(-COLOR_WINDOW - 1);
  30.   clWindowFrame = TColor(-COLOR_WINDOWFRAME - 1);
  31.   clMenuText = TColor(-COLOR_MENUTEXT - 1);
  32.   clWindowText = TColor(-COLOR_WINDOWTEXT - 1);
  33.   clCaptionText = TColor(-COLOR_CAPTIONTEXT - 1);
  34.   clActiveBorder = TColor(-COLOR_ACTIVEBORDER - 1);
  35.   clInactiveBorder = TColor(-COLOR_INACTIVEBORDER - 1);
  36.   clAppWorkSpace = TColor(-COLOR_APPWORKSPACE - 1);
  37.   clHighlight = TColor(-COLOR_HIGHLIGHT - 1);
  38.   clHighlightText = TColor(-COLOR_HIGHLIGHTTEXT - 1);
  39.   clBtnFace = TColor(-COLOR_BTNFACE - 1);
  40.   clBtnShadow = TColor(-COLOR_BTNSHADOW - 1);
  41.   clGrayText = TColor(-COLOR_GRAYTEXT - 1);
  42.   clBtnText = TColor(-COLOR_BTNTEXT - 1);
  43.   clInactiveCaptionText = TColor(-COLOR_INACTIVECAPTIONTEXT - 1);
  44.   clBtnHighlight = TColor(-COLOR_BTNHIGHLIGHT - 1);
  45.  
  46.   clBlack = TColor($000000);
  47.   clMaroon = TColor($000080);
  48.   clGreen = TColor($008000);
  49.   clOlive = TColor($008080);
  50.   clNavy = TColor($800000);
  51.   clPurple = TColor($800080);
  52.   clTeal = TColor($808000);
  53.   clGray = TColor($808080);
  54.   clSilver = TColor($C0C0C0);
  55.   clRed = TColor($0000FF);
  56.   clLime = TColor($00FF00);
  57.   clYellow = TColor($00FFFF);
  58.   clBlue = TColor($FF0000);
  59.   clFuchsia = TColor($FF00FF);
  60.   clAqua = TColor($FFFF00);
  61.   clLtGray = TColor($C0C0C0);
  62.   clDkGray = TColor($808080);
  63.   clWhite = TColor($FFFFFF);
  64.  
  65. const
  66.   cmBlackness = BLACKNESS;
  67.   cmDstInvert = DSTINVERT;
  68.   cmMergeCopy = MERGECOPY;
  69.   cmMergePaint = MERGEPAINT;
  70.   cmNotSrcCopy = NOTSRCCOPY;
  71.   cmNotSrcErase = NOTSRCERASE;
  72.   cmPatCopy = PATCOPY;
  73.   cmPatInvert = PATINVERT;
  74.   cmPatPaint = PATPAINT;
  75.   cmSrcAnd = SRCAND;
  76.   cmSrcCopy = SRCCOPY;
  77.   cmSrcErase = SRCERASE;
  78.   cmSrcInvert = SRCINVERT;
  79.   cmSrcPaint = SRCPAINT;
  80.   cmWhiteness = WHITENESS;
  81.  
  82. type
  83.   HMETAFILE = THandle;
  84.   TExtension = string[3];
  85.  
  86.   EInvalidGraphic = class(Exception);
  87.   EInvalidGraphicOperation = class(Exception);
  88.  
  89.   TGraphic = class;
  90.   TBitmap = class;
  91.   TIcon = class;
  92.   TMetafile = class;
  93.  
  94.   TResData = record
  95.     Handle: THandle;
  96.   end;
  97.  
  98.   TFontStyle = (fsBold, fsItalic, fsUnderline, fsStrikeOut);
  99.   TFontStyles = set of TFontStyle;
  100.   TFontPitch = (fpDefault, fpVariable, fpFixed);
  101.   TFontName = string[LF_FACESIZE - 1];
  102.  
  103.   TFontData = record
  104.     Handle: HFont;
  105.     Height: Integer;
  106.     Pitch: TFontPitch;
  107.     Style: TFontStyles;
  108.     Name: TFontName;
  109.   end;
  110.  
  111.   TPenStyle = (psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear,
  112.     psInsideFrame);
  113.   TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy,
  114.     pmMergePenNot, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,
  115.     pmNotMerge, pmMask, pmNotMask, pmXor, pmNotXor);
  116.  
  117.   TPenData = record
  118.     Handle: HPen;
  119.     Color: TColor;
  120.     Width: Integer;
  121.     Style: TPenStyle;
  122.   end;
  123.  
  124.   TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical,
  125.     bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross);
  126.  
  127.   TBrushData = record
  128.     Handle: HBrush;
  129.     Color: TColor;
  130.     Bitmap: TBitmap;
  131.     Style: TBrushStyle;
  132.   end;
  133.  
  134.   PResource = ^TResource;
  135.   TResource = record
  136.     Next: PResource;
  137.     RefCount: Integer;
  138.     Handle: THandle;
  139.     HashCode: Word;
  140.     case Integer of
  141.       0: (Data: TResData);
  142.       1: (Font: TFontData);
  143.       2: (Pen: TPenData);
  144.       3: (Brush: TBrushData);
  145.   end;
  146.  
  147.   TGraphicsObject = class(TPersistent)
  148.   protected
  149.     procedure Changed; dynamic;
  150.   public
  151.     property OnChange: TNotifyEvent;
  152.   end;
  153.  
  154.   TFont = class(TGraphicsObject)
  155.   protected
  156.     function GetHandle: HFont;
  157.     function GetHeight: Integer;
  158.     function GetName: TFontName;
  159.     function GetPitch: TFontPitch;
  160.     function GetSize: Integer;
  161.     function GetStyle: TFontStyles;
  162.     procedure SetColor(Value: TColor);
  163.     procedure SetHandle(Value: HFont);
  164.     procedure SetHeight(Value: Integer);
  165.     procedure SetName(const Value: TFontName);
  166.     procedure SetPitch(Value: TFontPitch);
  167.     procedure SetSize(Value: Integer);
  168.     procedure SetStyle(Value: TFontStyles);
  169.   public
  170.     constructor Create;
  171.     destructor Destroy; override;
  172.     procedure Assign(Source: TPersistent); override;
  173.     property Handle: HFont;
  174.     property PixelsPerInch: Integer;
  175.   published
  176.     property Color: TColor;
  177.     property Height: Integer;
  178.     property Name: TFontName;
  179.     property Pitch: TFontPitch default fpDefault;
  180.     property Size: Integer;
  181.     property Style: TFontStyles;
  182.   end;
  183.  
  184.   TPen = class(TGraphicsObject)
  185.   protected
  186.     function GetColor: TColor;
  187.     procedure SetColor(Value: TColor);
  188.     function GetHandle: HPen;
  189.     procedure SetHandle(Value: HPen);
  190.     procedure SetMode(Value: TPenMode);
  191.     function GetStyle: TPenStyle;
  192.     procedure SetStyle(Value: TPenStyle);
  193.     function GetWidth: Integer;
  194.     procedure SetWidth(Value: Integer);
  195.   public
  196.     constructor Create;
  197.     destructor Destroy; override;
  198.     procedure Assign(Source: TPersistent); override;
  199.     property Handle: HPen;
  200.   published
  201.     property Color: TColor default clBlack;
  202.     property Mode: TPenMode default pmCopy;
  203.     property Style: TPenStyle default psSolid;
  204.     property Width: Integer default 1;
  205.   end;
  206.  
  207.   TBrush = class(TGraphicsObject)
  208.   protected
  209.     function GetBitmap: TBitmap;
  210.     procedure SetBitmap(Value: TBitmap);
  211.     function GetColor: TColor;
  212.     procedure SetColor(Value: TColor);
  213.     function GetHandle: HBrush;
  214.     procedure SetHandle(Value: HBrush);
  215.     function GetStyle: TBrushStyle;
  216.     procedure SetStyle(Value: TBrushStyle);
  217.   public
  218.     constructor Create;
  219.     destructor Destroy; override;
  220.     procedure Assign(Source: TPersistent); override;
  221.     property Bitmap: TBitmap;
  222.     property Handle: HBrush;
  223.   published
  224.     property Color: TColor default clWhite;
  225.     property Style: TBrushStyle default bsSolid;
  226.   end;
  227.  
  228.   TFillStyle = (fsSurface, fsBorder);
  229.   TFillMode = (fmAlternate, fmWinding);
  230.  
  231.   TCopyMode = Longint;
  232.  
  233.   TCanvasStates = (csHandleValid, csFontValid, csPenValid, csBrushValid);
  234.   TCanvasState = set of TCanvasStates;
  235.  
  236.   TCanvas = class(TPersistent)
  237.   protected
  238.     procedure Changed; virtual;
  239.     procedure Changing; virtual;
  240.     procedure CreateHandle; virtual;
  241.   public
  242.     constructor Create;
  243.     destructor Destroy; override;
  244.     procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
  245.     procedure BrushCopy(const Dest: TRect; Bitmap: TBitmap;
  246.       const Source: TRect; Color: TColor);
  247.     procedure Chord(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
  248.     procedure CopyRect(const Dest: TRect; Canvas: TCanvas;
  249.       const Source: TRect);
  250.     procedure Draw(X, Y: Integer; Graphic: TGraphic);
  251.     procedure DrawFocusRect(const Rect: TRect);
  252.     procedure Ellipse(X1, Y1, X2, Y2: Integer);
  253.     procedure FillRect(const Rect: TRect);
  254.     procedure FloodFill(X, Y: Integer; Color: TColor; FillStyle: TFillStyle);
  255.     procedure FrameRect(const Rect: TRect);
  256.     procedure LineTo(X, Y: Integer);
  257.     procedure MoveTo(X, Y: Integer);
  258.     procedure Pie(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
  259.     procedure Polygon(const Points: array of TPoint);
  260.     procedure Polyline(const Points: array of TPoint);
  261.     procedure Rectangle(X1, Y1, X2, Y2: Integer);
  262.     procedure Refresh;
  263.     procedure RoundRect(X1, Y1, X2, Y2, X3, Y3: Integer);
  264.     procedure StretchDraw(const Rect: TRect; Graphic: TGraphic);
  265.     function TextHeight(const Text: string): Integer;
  266.     procedure TextOut(X, Y: Integer; const Text: string);
  267.     procedure TextRect(Rect: TRect; X, Y: Integer; const Text: string);
  268.     function TextWidth(const Text: string): Integer;
  269.     property ClipRect: TRect;
  270.     property Handle: HDC;
  271.     property PenPos: TPoint;
  272.     property Pixels[X, Y: Integer]: TColor;
  273.     property OnChange: TNotifyEvent;
  274.     property OnChanging: TNotifyEvent;
  275.   published
  276.     property Brush: TBrush;
  277.     property CopyMode: TCopyMode default cmSrcCopy;
  278.     property Font: TFont;
  279.     property Pen: TPen;
  280.   end;
  281.  
  282.   { The TGraphic class is a abstract base class for dealing with graphic images
  283.     such as metafile, bitmaps and icons; but is not limited to such.
  284.       LoadFromFile - Read the graphic from the file system.  The old contents of
  285.         the graphic are lost.  If the file is not of the right format, an
  286.         exception will be generated.
  287.       SaveToFile - Writes the graphic to disk in the file provided.
  288.       LoadFromStream - Like LoadFromFile except source is a stream (e.g.
  289.         TBlobStream).
  290.       SaveToStream - stream analogue of SaveToFile.
  291.       LoadFromClipboardFormat - Replaces the current image with the data
  292.         provided.  If the TGraphic does not support that format it will generate
  293.         an exception.
  294.       SaveToClipboardFormats - Converts the image to a clipboard format.  If the
  295.         image does not support being translated into a clipboard format it
  296.         will generate an exception.
  297.       Height - The native, unstretched, height of the graphic.
  298.       Width - The native, unstretched, width of the graphic.
  299.       OnChange - Called whenever the graphic changes }
  300.  
  301.   TGraphic = class(TPersistent)
  302.   protected
  303.     constructor Create; virtual;
  304.     procedure Changed(Sender: TObject);
  305.     procedure DefineProperties(Filer: TFiler); override;
  306.     procedure Draw(ACanvas: TCanvas; const Rect: TRect); virtual; abstract;
  307.     function GetEmpty: Boolean; virtual; abstract;
  308.     function GetHeight: Integer; virtual; abstract;
  309.     function GetWidth: Integer; virtual; abstract;
  310.     procedure ReadData(Stream: TStream); virtual;
  311.     procedure SetHeight(Value: Integer); virtual; abstract;
  312.     procedure SetWidth(Value: Integer); virtual; abstract;
  313.     procedure WriteData(Stream: TStream); virtual;
  314.   public
  315.     procedure Assign(Source: TPersistent); override;
  316.     procedure LoadFromFile(const Filename: string); virtual;
  317.     procedure SaveToFile(const Filename: string); virtual;
  318.     procedure LoadFromStream(Stream: TStream); virtual; abstract;
  319.     procedure SaveToStream(Stream: TStream); virtual; abstract;
  320.     procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
  321.       APalette: HPALETTE); virtual; abstract;
  322.     procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle;
  323.       var APalette: HPALETTE); virtual; abstract;
  324.     property Empty: Boolean;
  325.     property Height: Integer;
  326.     property Modified: Boolean;
  327.     property Width: Integer;
  328.     property OnChange: TNotifyEvent;
  329.   end;
  330.  
  331.   TGraphicClass = class of TGraphic;
  332.  
  333.   { TPicture }
  334.   { TPicture is a TGraphic container.  It is used in place of a TGraphic if the
  335.     graphic can be of any TGraphic class.  LoadFromFile and SaveToFile are
  336.     polymorphic. For example, if the TPicture is holding an Icon, you can
  337.     LoadFromFile a bitmap file, where if the class was TIcon you could only read
  338.     .ICO files.
  339.       LoadFromFile - Reads a picture from disk.  The TGraphic class created
  340.         determined by the file extension of the file.  If the file extension is
  341.         not recognized an exception is generated.
  342.       SaveToFile - Writes the picture to disk.
  343.       LoadFromClipboardFormat - Reads the picture from the handle provided in
  344.         the given clipboard format.  If the format is not supported, an
  345.         exception is generated.
  346.       SaveToClipboardFormats - Allocates a global handle and writes the picture
  347.         in its native clipboard format (CF_BITMAP for bitmaps, CF_METAFILE
  348.         for metafiles, etc.).  Formats will contain the formats written.
  349.         Returns the number of clipboard items written to the array pointed to
  350.         by Formats and Datas or would be written if either Formats or Datas are
  351.         nil.
  352.       SupportsClipboardFormat - Returns true if the given clipboard format
  353.         is supported by LoadFromClipboardFormat.
  354.       Assign - Copys the contents of the given TPicture.  Used most often in
  355.         the implementation of TPicture properties.
  356.       RegisterFileFormat - Register a new TGraphic class for use in
  357.         LoadFromFile.
  358.       RegisterClipboardFormat - Registers a new TGraphic class for use in
  359.         LoadFromClipboardFormat.
  360.       Height - The native, unstretched, height of the picture.
  361.       Width - The native, unstretched, width of the picture.
  362.       Graphic - The TGraphic object contained by the TPicture
  363.       Bitmap - Returns a bitmap.  If the contents is not already a bitmap, the
  364.         contents are thrown away and a blank bitmap is returned.
  365.       Icon - Returns an icon.  If the contents is not already an icon, the
  366.         contents are thrown away and a blank icon is returned.
  367.       Metafile - Returns a metafile.  If the contents is not already a bitmap,
  368.         the contents are thrown away and a blank metafile is returned. }
  369.   TPicture = class(TPersistent)
  370.   protected
  371.     procedure Changed(Sender: TObject);
  372.     procedure DefineProperties(Filer: TFiler); override;
  373.   public
  374.     destructor Destroy; override;
  375.     procedure LoadFromFile(const Filename: string);
  376.     procedure SaveToFile(const Filename: string);
  377.     procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
  378.       APalette: HPALETTE);
  379.     procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle;
  380.       var APalette: HPALETTE);
  381.     class function SupportsClipboardFormat(AFormat: Word): Boolean;
  382.     procedure Assign(Source: TPersistent); override;
  383.     class procedure RegisterFileFormat(const AExtension, ADescription: string;
  384.       AGraphicClass: TGraphicClass);
  385.     class procedure RegisterClipboardFormat(AFormat: Word;
  386.       AGraphicClass: TGraphicClass);
  387.     property Bitmap: TBitmap;
  388.     property Graphic: TGraphic;
  389.     property Height: Integer;
  390.     property Icon: TIcon;
  391.     property Metafile: TMetafile;
  392.     property Width: Integer;
  393.     property OnChange: TNotifyEvent;
  394.   end;
  395.  
  396.   { TMetafile }
  397.   { TMetafile is an encapsulation of Windows metafile rendering.
  398.       Handle - The metafile handle.
  399.       Inch - The units per inch assumed by the metafile.  Changing this
  400.         value changes the coordinate system and, therefore, the width
  401.         and height of the metafile.  New metafiles default to the device
  402.         LOGPIXELSPERINCH value given by Windows GDI. }
  403.  
  404.   TMetafileImage = class
  405.   end;
  406.  
  407.   TMetafile = class(TGraphic)
  408.   protected
  409.     function GetEmpty: Boolean; override;
  410.     function GetHeight: Integer; override;
  411.     function GetWidth: Integer; override;
  412.     procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
  413.     procedure ReadData(Stream: TStream); override;
  414.     procedure SetHeight(Value: Integer); override;
  415.     procedure SetWidth(Value: Integer); override;
  416.     procedure WriteData(Stream: TStream); override;
  417.   public
  418.     constructor Create;
  419.     destructor Destroy; override;
  420.     procedure LoadFromStream(Stream: TStream); override;
  421.     procedure SaveToStream(Stream: TStream); override;
  422.     procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
  423.       APalette: HPALETTE); override;
  424.     procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle;
  425.       var APalette: HPALETTE); override;
  426.     procedure Assign(Source: TPersistent); override;
  427.     property Handle: HMETAFILE;
  428.     property Inch: Word;
  429.   end;
  430.  
  431.   { TBitmap }
  432.   { TBitmap is an encapuslation of a Windows HBITMAP and HPALETTE.  It manages
  433.     the palette realizing automatically as well as having a Canvas to allow
  434.     modifications to the palette.  Creating copies of a TBitmap is very fast
  435.     since the handles is copied not the image.  If the image is modified, and
  436.     the handle is shared by more than one TBitmap object, the image is copied
  437.     before the modification is performed (i.e. copy on write).
  438.       Canvas - Allows drawing on the bitmap.
  439.       Handle - The HBITMAP encapsulated by the TBitmap.  Grabbing the handle
  440.         directly should be avoided since it causes the HBITMAP to be copied if
  441.         more than one TBitmap share the handle.
  442.       Palette - The HPALETTE realized by the TBitmap.  Grabbing this handle
  443.         directly should be avoided since it causes the HPALETTE to be copied if
  444.         more than one TBitmap share the handle.
  445.       Monochrome - True if the bitmap is a monochrome bitmap }
  446.  
  447.   TInternalImage = class
  448.   end;
  449.  
  450.   TBitmapImage = class(TInternalImage)
  451.   end;
  452.  
  453.   TBitmap = class(TGraphic)
  454.   protected
  455.     procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
  456.     function GetEmpty: Boolean; override;
  457.     function GetHeight: Integer; override;
  458.     function GetWidth: Integer; override;
  459.     procedure ReadData(Stream: TStream); override;
  460.     procedure SetWidth(Value: Integer); override;
  461.     procedure SetHeight(Value: Integer); override;
  462.     procedure WriteData(Stream: TStream); override;
  463.   public
  464.     constructor Create; override;
  465.     destructor Destroy; override;
  466.     procedure Assign(Source: TPersistent); override;
  467.     procedure Dormant;
  468.     procedure FreeImage;
  469.     procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
  470.       APalette: HPALETTE); override;
  471.     procedure LoadFromStream(Stream: TStream); override;
  472.     function ReleaseHandle: HBITMAP;
  473.     function ReleasePalette: HPALETTE;
  474.     procedure SaveToClipboardFormat(var Format: Word; var Data: THandle;
  475.       var APalette: HPALETTE); override;
  476.     procedure SaveToStream(Stream: TStream); override;
  477.     property Canvas: TCanvas;
  478.     property Handle: HBITMAP;
  479.     property Monochrome: Boolean;
  480.     property Palette: HPALETTE;
  481.     property TransparentColor: TColor;
  482.   end;
  483.  
  484.   { TIcon }
  485.   { TIcon encapsulates window HICON handle. Drawing of an icon does not stretch
  486.     so calling stretch draw is not meaningful.
  487.       Handle - The HICON used by the TIcon. }
  488.  
  489.   TIconImage = class(TInternalImage)
  490.   end;
  491.  
  492.   TIcon = class(TGraphic)
  493.   protected
  494.     procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
  495.     function GetEmpty: Boolean; override;
  496.     function GetHeight: Integer; override;
  497.     function GetWidth: Integer; override;
  498.     procedure SetHeight(Value: Integer); override;
  499.     procedure SetWidth(Value: Integer); override;
  500.     procedure SaveToClipboardFormat(var Format: Word; var Data: THandle;
  501.       var APalette: HPALETTE); override;
  502.   public
  503.     constructor Create; override;
  504.     destructor Destroy; override;
  505.     procedure Assign(Source: TPersistent); override;
  506.     procedure LoadFromStream(Stream: TStream); override;
  507.     function ReleaseHandle: HICON;
  508.     procedure SaveToStream(Stream: TStream); override;
  509.     property Handle: HICON;
  510.   end;
  511.  
  512.   { TImageList }
  513.  
  514.   TImageList = class
  515.   public
  516.     constructor Create(AWidth, AHeight: Integer);
  517.     destructor Destroy; override;
  518.     function Add(Image, Mask: TBitmap): Integer;
  519.     function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
  520.     procedure Replace(Index: Integer; Image, Mask: TBitmap);
  521.     procedure ReplaceMasked(Index: Integer; Image: TBitmap; MaskColor: TColor);
  522.     procedure Draw(Canvas: TCanvas; X, Y: Integer; Index: Integer);
  523.     procedure Delete(Index: Integer);
  524.     property Count: Integer;
  525.     property Delta: Integer;
  526.     property Width: Integer;
  527.     property Height: Integer;
  528.   end;
  529.  
  530. function GraphicFilter(GraphicClass: TGraphicClass): string;
  531. function GraphicExtension(GraphicClass: TGraphicClass): string;
  532.  
  533. function ColorToRGB(Color: TColor): Longint;
  534. function ColorToString(Color: TColor): string;
  535. function StringToColor(S: string): TColor;
  536. procedure GetColorValues(Proc: TGetStrProc);
  537. function ColorToIdent(Color: Longint; var Ident: string): Boolean;
  538. function IdentToColor(const Ident: string; var Color: Longint): Boolean;
  539.  
  540. function MemAlloc(Size: Longint): Pointer;
  541. procedure GetDIBSizes(Bitmap: HBITMAP; var InfoHeaderSize: Integer;
  542.   var ImageSize: Longint);
  543. function GetDIB(Bitmap: HBITMAP; Palette: HPALETTE; var BitmapInfo; var Bits): Boolean;
  544.  
  545. procedure InitGraphics;
  546. procedure PaletteChanged;
  547. procedure FreeMemoryContexts;
  548.  
  549. implementation
  550.